{extend name="public/base" /} {block name="title"}
<title>标签管理</title>
{__block__}
<link href="//cdn.bootcss.com/datatables/1.10.15/css/dataTables.bootstrap.min.css" rel="stylesheet">
<link href="//cdn.bootcss.com/limonte-sweetalert2/6.6.8/sweetalert2.min.css" rel="stylesheet">
<link href="https://cdn.bootcss.com/iCheck/1.0.2/skins/all.css" rel="stylesheet">
<style>
    .editTag :hover,
    .delTag :hover {
        color: #000;
    }
</style>
<script>
    var indexTagUrl = "{:url('tag/index')}"
    var addTagUrl = "{:url('tag/add')}"
    var editTagUrl = "{:url('tag/edit')}"
    var delTagUrl = "{:url('tag/del')}"
</script>
{/block} {block name="page-heading"}
<div class="col-sm-4">
    <h2>标签管理</h2>
    <ol class="breadcrumb">
        <li>
            <a href="{:url('admin/index/home')}">主页</a>
        </li>
        <li>
            <strong>标签管理</strong>
        </li>
    </ol>
</div>
<div class="col-sm-8">
    <div class="title-action">
        <a data-toggle="modal" href="#addTagModal" class="btn btn-primary">添加标签</a>
        <a href="{:url('article/index')}" class="btn btn-primary">文章管理</a>
        <a href="{:url('category/index')}" class="btn btn-primary">分类管理</a>
    </div>
</div> {/block} {block name="content"}
<table class="table tagTable table-striped table-hover table-condensed">
    <thead>
        <tr>
            <th></th>
            <th>标签名</th>
            <th>标识</th>
            <th>文章数</th>
            <th>操作</th>
        </tr>
    </thead>
    <tbody>
        {foreach name="data" item="tag"}
        <tr>
            <td>
                <input type="checkbox" value="{$tag.id}" name="tid">
            </td>
            <td>{$tag.name}</td>
            <td>{$tag.flag}</td>
            <td>{$tag.id|getCountByTag}</td>
            <td>
                <a class="text-success editTag">
                                        <i class="fa fa-pencil-square-o" ></i>
                                    </a>&nbsp;&nbsp;
                <a class="text-danger delTag">
                                        <i class="fa fa-trash"></i>
                                    </a>
            </td>
        </tr>
        {/foreach}
    </tbody>
    <tfoot>
        <tr>
            <th></th>
            <th>标签名</th>
            <th>标识</th>
            <th>文章数</th>
            <th>操作</th>
        </tr>
    </tfoot>
</table>
<a href="javascript:void(0)" class="btn btn-primary" onclick="selectAll('tid')">全选</a>
<a href="javascript:void(0)" class="btn btn-primary" onclick="selectEmpty('tid')">全不选</a>
<a href="javascript:void(0)" class="btn btn-primary" onclick="selectReverse('tid')">反选</a>
<a href="javascript:void(0)" class="btn btn-danger" id="delSelectedTag">删除选定</a> {/block} {block name="extra"}
<!--添加标签  -->
<div class="modal fade" id="addTagModal" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <form class="form-horizontal" role="form" id="addTagForm">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title">添加标签</h4>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">标签名</label>
                        <div class="col-sm-10">
                            <input type="text" name="name" class="form-control" placeholder="请输入标签名">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">标识</label>
                        <div class="col-sm-10">
                            <input type="text" name="flag" class="form-control" placeholder="请输入标签标识">
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="submit" class="btn btn-primary">提交</button>
                </div>
            </form>
        </div>
    </div>
</div>
<!--编辑标签  -->
<div class="modal fade" id="editTagModal" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <form class="form-horizontal" role="form" id="editTagForm">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title">编辑标签</h4>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">标签名</label>
                        <div class="col-sm-10">
                            <input type="text" name="name" class="form-control" id="editName" placeholder="请输入标签名">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">标识</label>
                        <div class="col-sm-10">
                            <input type="text" name="flag" class="form-control" id="editFlag" placeholder="请输入标签标识">
                        </div>
                    </div>
                    <input type="hidden" name="id" id="editId">
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="submit" class="btn btn-primary">更新</button>
                </div>
            </form>
        </div>
    </div>
</div> {/block}{block name="script"}{__block__}
<script src="//cdn.bootcss.com/datatables/1.10.15/js/jquery.dataTables.min.js"></script>
<script src="//cdn.bootcss.com/datatables/1.10.15/js/dataTables.bootstrap.min.js"></script>
<script src="//cdn.bootcss.com/limonte-sweetalert2/6.6.8/sweetalert2.min.js"></script>
<script src="//cdn.bootcss.com/iCheck/1.0.2/icheck.min.js"></script>
<script src="//cdn.bootcss.com/jquery-validate/1.17.0/jquery.validate.min.js"></script>
<script src="//cdn.bootcss.com/jquery-validate/1.17.0/localization/messages_zh.min.js"></script>
<script src="__CUSTOME__/js/admin.validate.js"></script>
<script src="__CUSTOME__/js/admin.common.js"></script>
<script>
    $(function () {
        $(".tagTable").dataTable({
            language: {
                url: "__PLUGINS__/dataTables/Chinese.json"
            },
            "columns": [{
                "orderable": false
            }, null, null, null, {
                "orderable": false
            }, ],
        });
        $(".i-checks").iCheck({
            checkboxClass: "icheckbox_square-green",
            radioClass: "iradio_square-green",
        });
    });
</script> {/block}